<form action="${CONTEXT_PATH}/m/menu/update" method="post" id="menu_update" class="form-horizontal">
    <input type="hidden" name="m.uuid" value="${m.uuid}"/>
<#include "/WEB-INF/template/page/admin/system/menu/_form.ftl"/>
    <script type="text/javascript">
        jQuery("#menu_update").ready(function () {
            $(this).find("#isleaf").val("${m.isleaf!}");
            $(this).find("#liveflag").val("${m.liveflag!}");

            // 定义验证参数
            var validateOptions = $.extend(CONST_VALIDATE.OPTION, {
                rules: {
                    "m.encode": {
                        required: true,
                        maxlength: 10
                    },
                    "m.name": {
                        required: true,
                        maxlength: 45
                    },
                    "m.url": {
                        required: true,
                        maxlength: 255
                    }
                },
                messages: {
                    "m.encode": {
                        required: "<i class='fa fa-exclamation tooltips'></i>请输入菜单缩写",
                        maxlength: $.validator.format("<i class='fa fa-exclamation tooltips'></i>菜单缩写不能大于{0}个字符")
                    },
                    "m.name": {
                        required: "<i class='fa fa-exclamation tooltips'></i>请输入节点名称",
                        maxlength: $.validator.format("<i class='fa fa-exclamation tooltips'></i>节点名称不能大于{0}个字符")
                    },
                    "m.url": {
                        required: "<i class='fa fa-exclamation tooltips'></i>请输入URL",
                        maxlength: $.validator.format("<i class='fa fa-exclamation tooltips'></i>URL不能大于{0}个字符")
                    }
                },
                submitHandler:function(form) {
                    var modal = $("#ajax_update");
                    $(form).ajaxSubmit(function (data, status, xhr) {
                        if (data.status) {
                            toastr.success(data.msg, '操作提示');
                        } else {
                            toastr.error(data.msg, '操作提示');
                        }
                    });
                    $(modal).modal('hide');
                }
            });
            //表单验证
            var validator = $("#menu_update").validate(validateOptions);
        });
    </script>
</form>